<script lang="ts" setup>
import Header from "./components/header.vue";
import Footer from "./components/footer.vue";
import CopyRight from "./components/copyright.vue";

const route = useRoute();
const path = route.path;

const currentPath = ref(path);
// 监听路由变化
watch(
  () => route.fullPath,
  (newPath) => {
    currentPath.value = newPath;
  }
);

const paths = [
  "/product_ability",
  "/solution/catering",
  "/solution/retail",
  "/solution/payment",
  "/developer",
  "/help",
];

/* 显示底部 */
const showFooter = () => {
  return paths.includes(currentPath.value);
};

/* 显示版权 */
const showCopyRight = () => {
  return !["/", ...paths].includes(currentPath.value);
};
</script>

<template>
  <div class="main">
    <!-- 导航栏 -->
    <Header :path="currentPath" />

    <!-- 主体 -->
    <div class="">
      <slot />
    </div>

    <!-- 底部 -->
    <Footer :path="currentPath" v-if="showFooter()" />

    <!-- 版权 -->
    <CopyRight v-if="showCopyRight()" :pt="showCopyRight()" />

    <client-only>
      <!-- 返回顶部 -->
      <Backtop />
    </client-only>
  </div>
</template>

<style lang="scss"></style>
